//
//  ZCSampleinformationVC.m
//  zctx
//
//  Created by apple on 15/12/15.
//  Copyright © 2015年 sanliang. All rights reserved.
//

#import "ZCSampleinformationVC.h"
#import "HZImagesGroupView.h"
@interface ZCSampleinformationVC ()
@property (nonatomic,strong)NSMutableArray *dataArray;

@property (nonatomic,strong)UICollectionView *collectionView;
@end

@implementation ZCSampleinformationVC

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    [MobClick beginLogPageView:@"ZCSampleinformationVC"];
    [MTA trackPageViewBegin:@"ZCSampleinformationVC"];
    
}
- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];
    [MobClick endLogPageView:@"ZCSampleinformationVC"];
    [MTA trackPageViewEnd:@"ZCSampleinformationVC"];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    [self initnavegation];
    self.view.backgroundColor = [UIColor groupTableViewBackgroundColor];
    self.navigationItem.title = @"样品信息";
    self.dataArray = [[NSMutableArray alloc]init];
    
    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
        [self requestdata];
    });
}
#pragma mark 导航栏
-(void)initnavegation{
    UIButton * leftButton = [UIButton buttonWithType:UIButtonTypeCustom];
    leftButton.frame = CGRectMake(0, 0, 19, 36);
    [leftButton setImage:[UIImage imageNamed:@"navigation_back"] forState:UIControlStateNormal];
    [leftButton addTarget:self action:@selector(backButtonPressed) forControlEvents:UIControlEventTouchUpInside];
    UIBarButtonItem * barButtonItem_leftNavBar = [[UIBarButtonItem alloc] initWithCustomView:leftButton];
    self.navigationItem.leftBarButtonItem = barButtonItem_leftNavBar;
    
}
-(void)backButtonPressed{
    ProgressDismiss;
    [self.navigationController popViewControllerAnimated:YES];
}

-(void)requestdata{
    ProgressHUDStr;
    [NetworkManager requestFoundingGetOnesamplesWithId:self.pid Mid:UserModel.mid password:UserModel.password success:^(NSArray *dictResponse) {
        ProgressDismiss;
        for (int i =0; i<dictResponse.count; i++) {
            if ([dictResponse[i] isKindOfClass:[NSDictionary class]]) {
                NSDictionary *dict = (NSDictionary *)dictResponse[i];
                NSString *strurl = [NSString stringWithFormat:@"%@/%@",[NetworkManager strURLBasic],[dict objectForKey:@"img_url"]];
                [self.dataArray addObject:strurl];
                [self initgroupView];
            }
        }
    } failure:^(NSError *error) {
        ProgressDismiss;
    }];
}

-(void)initgroupView{
    
    HZImagesGroupView *imagesGroupView = [[HZImagesGroupView alloc] initWithFrame:CGRectMake(0,0, SCREEN_WIDTH, SCREEN_HEIGHT)];
      imagesGroupView.photoItemArray =self.dataArray;
    [self.view addSubview:imagesGroupView];
}







@end
